import { List } from 'echarts';
import { BasicFetchResult, SaaSPageParams } from '/@/api/model/baseModel';

export interface AppSelectListItem {
  id: string;
  name: string;
}

export type AppName = {
  appName: string;
};

export interface AppParams {
  tenantCode: string;
}
export type AppPageParams = { model: AppName } & SaaSPageParams;

export interface AppInfo {
  id: string;
  appName: string;
  logo: string;
  oneaccessAppId: string;
  oneaccessClientId: string;
  oneaccessClientSecret: string;
  secretSalt: string;
}

export interface SubAppInfo {
  appId: string;
  subAppId: string;
  name: string;
  oneaccessAppId: string;
  effectiveTime: string | null;
  expireTime: string | null;
  onlineNum: number;
  packageType: string;
  logo: string;
  logoPath?: URL;
  versionPath?: string;
  duration?: string;
  type: number;
}

export interface AppUser {
  userId: string;
  userName: string;
  isAuth: boolean;
  roleIdList: string[];
}

export interface AppDto {
  app: AppInfo;
  components: string;
}

export type AppListGetResultModel = BasicFetchResult<AppDto>;

export interface AppSaveDto {
  id?: string;
  appName: string;
  oneaccessAppId: string;
  oneaccessClientId: string;
  oneaccessClientSecret: string;
  // logo: string; // TODO: LOGO上传
  prodsysInterfaceAddress: string;
  version: string;
  architecture: string;
  cloudMarketProductId: string;
  certifiedIntegrationProtocol: string;
  ifSupportIframe: string;
  description: string;
  cmAppId: string;
  cmRsaPublicKey: string;
  cmRsaPrivateKey: string;
}

export interface ApplicationItem {
  Id?: string;
  Name?: string;
  Image?: string;
  AppId?: string;
  ClientId?: string;
  CompId?: string;
  ISO?: string;
  Script?: string;
  Authorized?: string;
  Synchronized?: string;
  LoginConfig?: string;
  msg?: List;
}

// 请求参数：上传文件
export type UploadLogoParams = {
  appId: string;
};

export interface AppCardList {
  appId: string;
  architecture: string;
  description: string;
  ifIntegrateThirdApp: boolean;
  ifIntegrateCm: boolean;
  isSubscribed: number;
  logo: string;
  logoLink: string;
  name: string;
  type: number;
  version: string;
}

export interface SubscribeApp {
  appId: string;
  appMultiTenantMode: string;
  dbMultiTenantMode: string;
  deployStrategy: string;
  effectiveTime: string;
  expireTime: string;
  notificationEnabled: boolean;
  notificationTerminal: string;
  notificationType: string;
  packageId: string;
  packageSource: string;
  packageType: string;
  paymentType: string;
  specification: number;
  tenantCode: string;
  type: string;
}

export interface CertifiedIntegration {
  id: string;
  certifiedIntegrationProtocol: string;
  certifiedIntegrationAddress: string;
}

export interface SyncIntegration {
  id: string;
  syncIntegrationAddress: string;
  cmRsaPublicKey: string;
  cmRsaPrivateKey: string;
}

export interface ModuleModel {
  id: string;
  appId: string;
  name: string;
  protocol: string;
  port: string;
  cloudServerUuid: string;
  securityGroupName: string;
}

export type ModuleSave = {
  id: string;
  appId: string;
  name: string;
  protocol: string;
  port: string;
};

export interface AppProgram {
  appId: string;
  programName: string;
  programVersion: string;
  programUrl: string;
  programDir: string;
}

export interface CloudLinkInfo {
  appId: string;
  cloudLinkServerUrl: string;
  cloudLinkClientUrl: string;
  cloudLinkAuthUrl: string;
  cloudLinkServerDir: string;
  clusterkey: string;
  managePort: string;
  rdpPort: string;
  vcredistX86Url: string;
  vcredistX64Url: string;
}

export type deleteDto = {
  id: string;
};

export interface AppCardInfo {
  id: string;
  name: string;
  nameEn: string;
  architecture: string;
  version: string;
  description: string;
  idaasAppId: string;
  idaasClientId: string;
  idaasClientSecret: string;
  domain: string;
  ifIntegrateThirdApp: boolean;
  ifIntegrateCm: boolean;
  cmAppId: string;
  cmProductId: string;
  prodsysInterfaceAddress: string;
  certifiedIntegrationProtocol: string;
  certifiedIntegrationAddress: string;
  syncIntegrationAddress: string;
  cmRsaPublicKey: string;
  cmRsaPrivateKey: string;
}

export type RoleRelation = {
  userId: string;
  roleIdList: string[];
};
